<%@ page language="java" import="java.util.*,com.eorchis.utils.ScriptLoader" pageEncoding="utf-8"%>
<%@ page isELIgnored="false" %>
<%@ page import="com.eorchis.module.security.cas.domain.Role,java.util.*" language="java" %>
<%@ include file="./common/orchid/styleChoose.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<% 
	String loginID=(String)session.getAttribute("loginID");
    if(loginID==null||loginID.equals("null")||loginID.equals("")){
		loginID="2443675";
    }
    List<Role> list=(List<Role>)session.getAttribute("roles");
    int result=list.size();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>在线学习统一管理平台</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="${pageContext.request.contextPath}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<script type="text/javascript" language="javaScript" src="${pageContext.request.contextPath}/common/orchid/install_cookie.js"></script>
<script type="text/javascript" language="javaScript">
	    var style1 = judgeCookie("<c:out value='<%=style %>' />");
	    var roleListSize="<c:out value='<%=result  %>' />";
	    if(roleListSize==0){
		   window.location.href="./welcome.jsp";	 
	    }
</script>
<link rel="stylesheet" type="text/css" href="./common/extjs/ux/css/ItemSelector.css" />


    <!-- 
    <script type="text/javascript" src="./skin/default/bootstrap.js"></script>
    -->

    <!-- 
	<style type="text/css">
		/* 鼠标移入加粗，如果改变则所有全部改变，包括树 */
		.x-grid-row-over .x-grid-cell-inner {
		    font-weight: bold;
		}
	</style>
	 -->
	 <style type="text/css">
	 	/* 去掉textarea在谷歌浏览器下可改变大小 */
	 	textarea{
	 		font-size:13px; 
	 		resize:none;
	 	}
		#init-loading-mask{
	        background-color:white;
	        height:100%;
	        position:absolute;
	        left:0;
	        top:0;
	        width:100%;
	        z-index:20000;
	    }
	    #init-loading{
	        height:auto;
	        position:absolute;
	        left:45%;
	        top:40%;
	        padding:2px;
	        z-index:20001;
	    }
	    #init-loading a {
	        color:#225588;
	    }
	    #init-loading .init-loading-indicator{
	        background:white;
	        color:#444;
	        font:bold 13px Helvetica, Arial, sans-serif;
	        height:auto;
	        margin:0;
	        padding:10px;
	    }
		#init-loading-msg {
	        font-size: 10px;
	        font-weight: normal;
	    }
	    /*列表上统计人数样式*/
	    .countFont {
	        color:red;
	        font:bold 13px Helvetica, Arial, sans-serif;
	        height:auto;
	    }
	</style>
</head>
<script type="text/javascript">
		//document.domain = "demo.com";
  		var head=document.getElementsByTagName('head').item(0); 
  		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/ext-all.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 

		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/icons2.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 

		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/reset.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 

		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/style.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 

		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/navIconStyle.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 
 		
 		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/ui.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 
 		
 		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/projectExt.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 
 		
 		css=document.createElement('link'); 
  		css.href="./skin/" + style1 + "/css/judge.css";
  		css.rel='stylesheet'; 
  		css.type='text/css'; 
  		css.id='loadCss'; 
 		head.appendChild(css); 
</script>
<body>
	<div id="init-loading-mask" style=""></div>
    <div id="init-loading">
        <div class="init-loading-indicator">
            <img id="loadingImg"  width="32" height="32" style="margin-right:8px;float:left;vertical-align:top;"/>
            <span id="init-loading-msg">加载样式及图片...</span>
        </div>
    </div>
    <input type="hidden" name="login_Id" id="login_Id" value="<c:out value='<%=loginID  %>' />"/>
    <script type="text/javascript">
		document.getElementById("loadingImg").src="./skin/"+style1+"/images/orchidLoading2.gif";
    	document.getElementById('init-loading-msg').innerHTML = '正在进入系统，请稍后......';
    </script>    <!-- GC -->
    
    <script type="text/javascript" src="./common/extjs/ext-all${param.debug?"-debug":""}.js"></script>
    <script type="text/javascript" src="./workbench/project/store/SpecialStore.js"></script>
    <script type="text/javascript" src="./workbench/orchid/store/SpecialStore.js"></script>
    <script type="text/javascript" src="./common/extjs/DefaultVType.js"></script>
    <script type="text/javascript" src="./common/orchid/modulesOnclick.js"></script>
    <script type="text/javascript" src="./common/project/modulesOnclick.js"></script>
    
    <%
    	ScriptLoader scriptload =new ScriptLoader();
 		String scriptPath = scriptload.loadOrchidCommonScript(request);
    	out.println(scriptPath);
    	scriptPath = scriptload.loadProjectCommonScript(request);
    	out.println(scriptPath);
    %>	
    <script type="text/javascript" src="./common/project/workbench/public_SpecialStore.js"></script>
    <script type="text/javascript" src="app.js"></script>
    <script type="text/javascript" src="./common/extjs/locale/ext-lang-zh_CN.js"></script>
    
    <script type="text/javascript">
    	var style1 = judgeCookie("<c:out value='<%=style %>' />");
    	document.getElementById("loadingImg").src="./skin/"+style1+"/images/orchidLoading2.gif";
	    var Orchid = {
	    		alert: function(title, msg, fn){
	    			Ext.create('AM.default.DefaultAlertBox', {
	    	  			title: title || "",
	    	  			msg: msg || "",
	    	  			fn: fn
	    	  		});
	    	    }
	    	};
    
    	String.prototype.trim = function(){
		    return this.replace(/(^\s*)|(\s*$)/g,"");
		}
    	
    	Ext.get('init-loading').remove();
        Ext.fly('init-loading-mask').animate({
            opacity:0,
            remove:true
        });
        Ext.Ajax.timeout = 180000;
        /*
		Ext.Ajax.addListener("requestcomplete", function(conn, response, options, eOpts){
			var data = response.responseText;
            var json = Ext.decode(data, true);
            if (!json.success && json.msg == "系统错误，请联系管理员。") {
            	Ext.Msg.alert('消息', json.msg);
            }
		});
		*/
		
    </script>
    <!-- 图片上传功能 -->
	<script type="text/javascript" src="./common/jquery/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="./common/orchid/json2.js"></script>
	<script type="text/javascript" src="./common/fileupload/swfupload.js"></script>
	<script type="text/javascript" src="./common/fileupload/js/swfupload.queue.js"></script>
<!-- 	<script type="text/javascript" src="./common/fileupload/js/swfupload.speed.js"></script> -->
	<script type="text/javascript" src="./common/fileupload/js/handlers.js"></script>

	<!-- 附件上传 -->	
	<script type="text/javascript">
		var style1 = judgeCookie("<c:out value='<%=style %>' />");
		var swfu;
		var oldAttId = 0;
		var loadMask =  new Ext.LoadMask(this, {
                msg: "正在上传图片,请稍后...."
            });
		function uploadFiles(button_id,localStar,uploadUrl,beforeEvent,afterEvent,fileTypes,fileData){
			this.flash_url = localStar+"common/fileupload/swf/swfupload.swf";
			//this.upload_url= "./workbench/orchid/data/tabPicture.jsons"; //Demo
			this.upload_url= uploadUrl;  //后台上传图片路径(多次浏览时删除无用图片)
			//this.file_size_limit = "2048KB";
			this.file_types =fileTypes|| "" ;
			this.file_types_description = "Files";
			this.file_post_name=fileData||"FileData",
			this.file_upload_limit = 0;
			this.file_queue_limit  = 1;
			this.debug= false;
			// Button settings
			this.button_image_url="./common/fileupload/images/XPButtonUploadNoImage_61x22.png";
			this.button_text= '';
			this.button_width= "28";
			this.button_height= "22";
			this.button_window_mode= "opaque";
			this.button_placeholder_id=button_id;
	
			this.moving_average_history_size= 40;
	
			this.file_queued_handler =beforeEvent;//上传
			this.file_dialog_complete_handler= fileDialogComplete;//上传
			this.file_queue_error_handler = fileQueueError;
	
			//upload_start_handler = uploadStart;
			this.upload_progress_handler = uploadProgress;
			this.upload_success_handler = afterEvent;
			this.upload_complete_handler = uploadComplete
		};
		function createSettings(button_id,img_id,newImg_idName,localStar,grid){
			this.flash_url = localStar+"common/fileupload/swf/swfupload.swf";
			//this.upload_url= "./workbench/orchid/data/tabPicture.jsons"; //Demo
			this.upload_url= localStar+"components/attachment/upload.json";  //后台上传图片路径(多次浏览时删除无用图片)
			this.file_size_limit = "2048KB";
			this.file_types = "*.jpg;*.jpeg;*.JPG;*.JPEG;*.png;*.PNG;*.gif;*.GIF";
			this.file_types_description = "Image Files";
			this.file_upload_limit = 0;
			this.file_queue_limit  = 1;
			this.debug= false;
			// Button settings
			this.button_image_url= "./skin/" + style1 + "/images/upload.png";
			this.button_text= '&nbsp;&nbsp;&nbsp;浏览...';
			this.button_width= "75";
			this.button_height= "20";
			this.button_window_mode= "opaque";
			this.button_placeholder_id=button_id;
	
			this.moving_average_history_size= 40;
	
			//上传中...
			this.file_queued_handler = function(file){
				loadMask.show();
				var attachmentID=document.getElementsByName(newImg_idName)[0].value;
				if(attachmentID!=null&&attachmentID!=""){
					this.setPostParams({"attachmentID":attachmentID	});
				}
			};//上传
			this.file_dialog_complete_handler= fileDialogComplete;//上传
			this.file_queue_error_handler = fileQueueError;
	
			//upload_start_handler = uploadStart;
			this.upload_progress_handler = uploadProgress;
			//上传成功
			this.upload_success_handler = function(file, serverData){
				serverData=JSON.parse(serverData);
				var uploadUrl = localStar+"components/attachment/download.do?attachmentID="+serverData.data.attachmentID+"&oldAttId="+oldAttId;
				if(grid){
					if(img_id == "fMImageId"){
						if($(".fontSpan").length > 0){
					         $(".fontSpan").remove();
				        }
					}else if(img_id == "tJImageId"){
						if($(".fontSpanTj").length > 0){
							$(".fontSpanTj").remove();
					    }
					}
					grid.down("#"+img_id).setSrc(uploadUrl);
					grid.getForm().findField(newImg_idName).setValue(serverData.data.attachmentID);
				}else{
					document.getElementById(img_id).src =uploadUrl;//Demo
					Ext.getCmp(newImg_idName).setValue(serverData.data.attachmentID);
				}
				oldAttId++;
				loadMask.hide();
				//获取的是之前旧图片的id
				//oldAttId = document.getElementsByName(oldImg_idName)[0].value;
				//serverData为框架给的值id，fileDownload.do为真正后台下载的路径
				//document.getElementById(img_id).src = "./workbench/orchid/data/tabPicture.jsons?attachmentID="+serverData.data.attachmentID;//Demo
				//document.getElementById(img_id).src = "./components/attachment/download.do?attachmentID="+serverData.data.attachmentID;
				//将新下载后的图片的id再赋值回去
				//document.getElementsByName(newImg_idName)[0].value=serverData.data.attachmentID; //谷歌浏览器下能用，IE则获取不到值
				//Ext.getCmp(newImg_idName).setValue(serverData.data.attachmentID);
				//document.getElementById("message").innerHTML='';
			};//上传成功后执行
			this.upload_complete_handler = uploadComplete
			
		};
		
	</script>
    <script type="text/javascript">
		if(!Ext.isIE6) {
			// 以下代码导致window.open()不能使用
			 /* var open = window.XMLHttpRequest.prototype.open,
		    send = window.XMLHttpRequest.prototype.send,
		    onReadyStateChange;
		
			function openReplacement(method, url, async, user, password) {
			    var syncMode = async !== false ? 'async' : 'sync';
			    return open.apply(this, arguments);
			}
			window.XMLHttpRequest.prototype.open = openReplacement; */
			var send = window.XMLHttpRequest.prototype.send,
		    onReadyStateChange;
			function sendReplacement(data) {
			
			    if(this.onreadystatechange) {
			        this._onreadystatechange = this.onreadystatechange;
			    }
			    this.onreadystatechange = onReadyStateChangeReplacement;
			
			    return send.apply(this, arguments);
			}
			
			function onReadyStateChangeReplacement() {
				if(this.readyState == 4) {
					if(this.responseText) {
						if(this.responseText.indexOf("login1") == 0) {
							alert("抱歉，由于您长时间未操作系统，请您重新登录。");
							window.location.href = 'logout.jsp';
						} else if(this.responseText.indexOf("login2") == 0) {
							alert("您的账号已在另一个地方登录。");
							window.location.href = 'logout.jsp';
						} else if(this.status==404){
							alert("您访问的请求不存在。");
						} else if(this.responseText.trim().charAt(0) == '<') {
							alert("登陆超时，请重新登录。");
							window.location.href = 'logout.jsp';
						}
					}
				}
				if(this._onreadystatechange&&this.readyState==4) {
					return this._onreadystatechange.apply(this, arguments);
				}
			}
			
			window.XMLHttpRequest.prototype.send = sendReplacement;
		}
	</script>
	<!-- 设置基础路径 -->
	<script type="text/javascript">
		var basePath = '${pageContext.request.contextPath}';
	</script>
	<a id="exportResume" target="_blank"></a><!-- 作为简历导出的新弹出页面 -->
	<form target="_blank" action="http://el.demo.com/exam/module/courseexam/qusetions/exportQuestions.do" method="post" id="exportQuestions">
		<input type="hidden" name="searchCourseResourceID" id="searchCourseResourceID"/>
	</form>
	<!-- 导出的新弹出页面 -->
	<form method="post" action="" id="countForm">
		<input type="hidden" name="params" value="" id="countValue"/>
	</form>
	<iframe style="display: none" id="tempFrame" src="" />
</body>

</html>
